<template>
	<view v-if="is_init">
		<uni-popup-input name="新增/编辑" @close="on_close">
			
			<view class=" cred p-b-20 w800 f-15">
				提醒城市大概在350个左右
			</view>

	

			<view class="banmi_input_edit a-c">
				<view class="banmi_input_edit_name">
					<text class="cred">*</text>名称级别
				</view>
				<view class="banmi_input_val">
					<uni-easyinput v-model="find.name" placeholder="请输入名称级别">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_input_edit a-c">
				<view class="banmi_input_edit_name">
					固定城市数(优先级最高)
				</view>
				<view class="banmi_input_val">
					<uni-easyinput v-model="find.num" placeholder="请输入固定城市数">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_input_edit a-c">
				<view class="banmi_input_edit_name">
					最小城市数
				</view>
				<view class="banmi_input_val">
					<uni-easyinput v-model="find.min_num" placeholder="请输入最小城市数">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_input_edit a-c">
				<view class="banmi_input_edit_name">
					最大城市数
				</view>
				<view class="banmi_input_val">
					<uni-easyinput v-model="find.max_num" placeholder="请输入最大城市数">
					</uni-easyinput>
				</view>
			</view>
			<view class="banmi_input_edit a-c">
				<view class="banmi_input_edit_name">
					<text class="cred">*</text>比例（%）
				</view>
				<view class="banmi_input_val">
					<uni-easyinput v-model="find.proportion" placeholder="请输入比例">
					</uni-easyinput>
				</view>
			</view>
			 
		 
			 


			<view class="a-c  p-b-20 banmi_input_edit">
				<view class="banmi_input_edit_name">
				</view>
				<view class="">
					<button @click="on_sava()" type="primary" style="width: 80px;" size="mini">保存</button>
				</view>
			</view>

		</uni-popup-input>
		<!-- 	颜色选择器 -->
		<t-color-picker ref="colorPicker" @confirm="confirm_color"></t-color-picker>
	</view>
</template>

<script>
	import provinceData from '@/components/fd-picker/city-china.json';

	export default {
		components: {},
		props: {

		},
		data() {
			return {
				find: {},

				is_init: false,
				localdata_jump_id: [],
				nav_list: [],
				img_url: '',
				arr_val: [{
						"value": '1',
						"text": "按钮1",
					},
					{
						"value": "2",
						"text": "按钮2",
					},
					{
						"value": "3",
						"text": "按钮3",
					},
				],
				provinceData: provinceData, //本地省市区数据 
				screenWidth: 0,
				localdata_category_id: [],
			}
		},

		methods: {
			 
			on_sava() {
				var that = this;
				this.find.id = this.id
				this.Http.post('luyouzujiditu/admin/Top/edit', this.find).then(ret => {
					uni.showToast({
						title: ret.msg,
						icon: 'none'
					})
					if (ret.status == 200) {
						this.$emit("confirm");
						this.on_close();
					}
				})
			},
			init(id) {
			 
				var that = this;
				that.id = id
				if (that.id == 0) {
					this.find = {
						category_id: '',
						img: '',
						name: '',
						min_num: '',
						sort: '',
						num: '',
						status: '',
						userip: '',
						max_num: '',
						proportion: ''

					};
					this.is_init = true;
					return
				}
				let requestParams = {
					id: that.id,
				};
				this.Http.post('luyouzujiditu/admin/Top/views', requestParams).then(ret => {
					if (ret.status == 200) {
						this.find = ret.data.find;
						this.is_init = true;
						return
					}
					uni.showToast({
						title: ret.msg,
						duration: 2000,
						icon: 'error'
					});
				})
			},

			on_close() {
				this.is_init = false;
			},
			//js分类方法

		}
	}
</script>

<style>
	button::after {
		border: none;
	}

	.top_head {
		background-color: #F8F8F8;
		width: 100%;
		top: 0;
		left: 0;
		z-index: 999;
		position: sticky
	}

	.but {
		width: 120rpx;
		height: 100rpx;
		padding: 0;
		border: 0;
		background-color: transparent;
		outline: none;
	}
</style>